package com.yixin.my.proj.service.impl;

import com.yixin.my.proj.common.PageInfo;
import com.yixin.my.proj.dao.LogDao;
import com.yixin.my.proj.domain.Log;
import com.yixin.my.proj.service.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class LogServiceImpl implements LogService {
    @Autowired
    private LogDao logDao;
    @Override
    public List<Log> selectAll() {
        return logDao.selectAll();
    }

    @Override
    public PageInfo<Log> page(Map<String, Object> params) {
        PageInfo<Log> pageInfo = new PageInfo<>();

        int count = logDao.count();
        List<Log> logs = logDao.page(params);
        pageInfo.setRecordsTotal(count);
        pageInfo.setRecordsFiltered(count);
        pageInfo.setData(logs);
        return pageInfo;
    }
}
